#include "action.hpp"
#include "factory.hpp"
#include "global.hpp"
#include <nlohmann/json_fwd.hpp>

class Close : public Action
{
  public:
    Close(const nlohmann::json &j) : Action(j) {}
    virtual bool Execute() override final
    {
        for (auto rule : Global::Instance().config->rules)
        {
            rule.AsyncTerminate();
        }
        return true;
    }
    virtual void Terminate() override final {}
};

static Factory<Action>::Register<Close> reg("close");